/*--------------------------------------------------------------------------------------*\
**
** dialog_blacksmith.h
**
** Heroes IV
** Copyright 2000, The 3DO Company
**
\*--------------------------------------------------------------------------------------*/

#ifndef DIALOG_BLACKSMITH_H_INCLUDED
#define DIALOG_BLACKSMITH_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <vector>
#include "bitmap_group_ptr.h"
#include "blacksmith_window.h"
#include "button_group.h"
#include "creature_array_window_ptr.h"
#include "game_window.h"

class t_army;
class t_button;
class t_player;

class t_dialog_blacksmith : public t_window
{
public:
	t_dialog_blacksmith( t_window* parent );
  void init_dialog( t_window* parent_window, t_army* army, t_artifact_type *potions_ptr, t_artifact_type *items_ptr,
                    t_artifact_type *long_items_ptr);

protected:
	t_adventure_frame *     m_adventure_frame;
	t_bitmap_group_ptr		m_background_bitmaps_ptr;
	t_bitmap_group_ptr	    m_picture_bitmaps_ptr;
	t_army                  *m_army_ptr;
    t_player *			    m_player_ptr;
	t_creature_array_window *m_creature_window_ptr;
	t_bitmap_layer_window   *m_selected_creature_window_ptr;
    t_artifact_type         m_available_items[k_max_items];
    t_artifact_type         m_available_potions[k_max_potions];
    t_blacksmith_item       m_items[k_max_items];
    t_blacksmith_item       m_potions[k_max_potions];
	int						m_player_funds;
	int						m_current_cost;
	t_text_window*          m_cost_window_ptr;
	t_text_window*          m_total_gold_text_ptr;
    t_button*               m_buy_button_ptr;
	int						m_selected_creature;
	bool					m_ran_army_dialog;

    bool check_buy_button_disable();
    void create_creature_windows();
	void creature_double_click( t_creature_array_window* window, int slot );
    t_creature_stack *get_selected_creature();
    void show_current_creature();
    void create_item_display( t_artifact_type item_type, char *type_name,
                    t_window* bg_window_ptr, t_blacksmith_item *item, int index );
    void item_clicked_up( t_button *button_ptr, t_blacksmith_item *item );
    void item_clicked_down( t_button *button_ptr, t_blacksmith_item *item );
    void add_to_total_cost(int amount);
    void subtract_from_total_cost(int amount);
    void hero_select( t_creature_array_window* window_ptr, int slot );
    void buy_click( t_button *button_ptr );
    void close_click( t_button *button_ptr );
	void enemy_attack_handler();
};

#endif // DIALOG_BLACKSMITH_H_INCLUDED

